#!/usr/bin/python
# -*- coding: UTF-8 -*-

import nltk
import jieba

# nltk.download('punkt')
# nltk.download('stopwords')

text = open('The day you went away').read()
fdist = nltk.FreqDist(nltk.word_tokenize(text))
fdist.plot(30,cumulative=True)

raw=open('forgotten_times.txt').read()
text=nltk.text.Text(jieba.lcut(raw))

print text.concordance(u'风花雪月')
print text.common_contexts([u'一起',u'一同'])
text.collocations()